<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
 *
 */
class Plugin_Contactsys extends Plugin
{

	function contactus(){
		$form = site_url('cricket/contact/contact_us_submit');
		$captcha = newCaptcha();
		$loader=  loader_image('id="loader_image" class="hidden"'); 
		
		$html = "";
		$html .= "<div id=\"wrap-contactus\">";
		$html .= "<form action=\"{$form}\" id=\"contact_us_submit\" name=\"contact_us_submit\" method=\"post\" >";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Name*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='name' id='name' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Email Address*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='email' id='email' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Mobile Number</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='mobile' id='mobile' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Subject*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='subject' id='subject' maxlength='145' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Message*</label></div>";
		$html .= "<div class=\"input-field\"><textarea class='message' name='message' id='message' maxlength='550' ></textarea></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Security Code*</label></div>";
		$html .= "<div class=\"input-field\">
			{$captcha} <b/>
			<div class=\"clrboth\"></div>
			<input type='text' name='captcha' id='captcha' maxlength='15' />
			</div>";
		$html .= "</div>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field\">
					<input type='submit' class='submit button' name='send' id='send' value='Send' />
					{$loader}
				</div>";
		$html .= "</div>"; 
		
		$html .= "</form>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='errorbox'></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='successbox'></div>";
		$html .= "</div>"; 
		
		$html .= "</div>";
		
		$html .= "<script type='text/javascript'>
				$(document).ready(function(){
					var option = { 
							beforeSubmit:  validateBeforeSubmit,  
							success: processAfterSubmit
						};	
					$('#contact_us_submit').ajaxForm(option);
				});
				function validateBeforeSubmit(formData, jqForm, options){
					$('#successbox,#errorbox').hide();
					$('#loader_image').toggle();
					return true;
				}
				function processAfterSubmit(responseText, statusText, xhr, form){
					var obj = jQuery.parseJSON( responseText );
					 
					$('#loader_image').toggle();
					if(obj.result == 'ok'){
						$('#successbox').html(obj.msg).show();
						jqResetForm('contact_us_submit');
						//setTimeout('reload()',4000);
						queryURL(BASE_URI+MODULE+'/contact/contact_notify');
					}else{
						$('#errorbox').html(obj.msg).show();
					}
				}
			</script>
		";
		
		return $html;
	}


	function contacthelp(){
		
		$form = site_url('cricket/contact/contact_help_submit');
		$captcha = newCaptcha();
		$loader=  loader_image('id="loader_image" class="hidden"'); 
		
		$array = array('General'=>'General','Technical'=>'Technical','Customer Support'=>'Customer Support','Others'=>'Others');
		$formdd = form_dropdown('issue_type',$array,array(),'id="issue_type" ');
		
		$html = "";
		$html .= "<div id=\"wrap-contactus\">";
		$html .= "<form action=\"{$form}\" id=\"contact_help_submit\" name=\"contact_help_submit\" method=\"post\" >";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Name*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='name' id='name' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Email Address*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='email' id='email' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Mobile Number</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='mobile' id='mobile' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Type Of Issue*</label></div>";
		$html .= "<div class=\"input-field\">{$formdd}</div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Subject*</label></div>";
		$html .= "<div class=\"input-field\"><input type='text' name='subject' id='subject' maxlength='145' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Message*</label></div>";
		$html .= "<div class=\"input-field\"><textarea class='message' name='message' id='message' maxlength='550' ></textarea></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label>Security Code*</label></div>";
		$html .= "<div class=\"input-field\">
			{$captcha} <b/>
			<div class=\"clrboth\"></div>
			<input type='text' name='captcha' id='captcha' maxlength='15' />
			</div>";
		$html .= "</div>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field\">
					<input type='submit' class='submit button' name='send' id='send' value='Send' />
					{$loader}
				</div>";
		$html .= "</div>"; 
		
		$html .= "</form>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='errorbox'></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='successbox'></div>";
		$html .= "</div>"; 
		
		$html .= "</div>";
		
		$html .= "<script type='text/javascript'>
				$(document).ready(function(){
					var option = { 
							beforeSubmit:  validateBeforeSubmit,  
							success: processAfterSubmit
						};	
					$('#contact_help_submit').ajaxForm(option);
				});
				function validateBeforeSubmit(formData, jqForm, options){
					$('#successbox,#errorbox').hide();
					$('#loader_image').toggle();
					return true;
				}
				function processAfterSubmit(responseText, statusText, xhr, form){
					var obj = jQuery.parseJSON( responseText );
					 
					$('#loader_image').toggle();
					if(obj.result == 'ok'){
						$('#successbox').html(obj.msg).show();
						jqResetForm('contact_help_submit');
						//setTimeout('reload()',4000);
						queryURL(BASE_URI+MODULE+'/contact/contact_notify');
					}else{
						$('#errorbox').html(obj.msg).show();
					}
				}
			</script>
		";
		
		return $html;
	}






















//endclass
}